package com.youxin.jobcenter.timers;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.youxin.foundation.utils.thread.ScheduleThreadPool;
import com.youxin.jobcenter.service.PayStatusCheckService;


/**
 * 
 * @ClassName: TrandeQueryTimers 
 * @Description: 支付交易查询任务 
 * @author yingde.cao
 * @date 2017年12月18日 下午2:56:17 
 *
 */
@Service
public class PayStatusCheckJob {
	
	private static final Logger logger = Logger.getLogger(PayStatusCheckJob.class);
	@Autowired
	public PayStatusCheckService payStatusCheckService;
	/**
	 * 执行方法
	 */
	public void execute() {
		try {
			ScheduleThreadPool.scheduleWithFixedDelay(new Runnable() {				
				@Override
				public void run() {
					try {
						System.out.println("查询任务开启");
						payStatusCheckService.selectFailurePayOrderList();
					} catch (Exception e) {
						logger.error("PayStatusCheckJob",e);
					}
				}
			}, 30000, 1000);
			
		} catch (Exception e) {
			logger.error("Execute", e);
		}
	}
}
